package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.wap.dao.IFpShopUserBackgroundDao;
import com.financing.wap.dto.FpShopUserBackgroundDTO;
import com.financing.wap.service.IFpShopUserBackgroundService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * fp_shop_user_background  
 * 用户背景图片表 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("fpShopUserBackgroundService")
public class FpShopUserBackgroundServiceImpl implements IFpShopUserBackgroundService{

	@Autowired
	private IFpShopUserBackgroundDao fpShopUserBackgroundDao;

	@Override
	public int insert(FpShopUserBackgroundDTO fpShopUserBackground) throws SQLException {
		DTOdateSetUtil.setCreateInfo(fpShopUserBackground);
		DTOdateSetUtil.setUpdateInfo(fpShopUserBackground);
		
		return fpShopUserBackgroundDao.insert(fpShopUserBackground);
	}

	@Override
	public void update(FpShopUserBackgroundDTO fpShopUserBackground) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpShopUserBackground);
		fpShopUserBackgroundDao.update(fpShopUserBackground);
	}

	@Override
	public void updateForce(FpShopUserBackgroundDTO fpShopUserBackground) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpShopUserBackground);
		fpShopUserBackgroundDao.updateForce(fpShopUserBackground);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		fpShopUserBackgroundDao.delete(id);
	}
	
	@Override
	public List<FpShopUserBackgroundDTO> queryList(FpShopUserBackgroundDTO fpShopUserBackground) throws SQLException {
		return fpShopUserBackgroundDao.queryList(fpShopUserBackground);
	}

	@Override
	public int queryListCount(FpShopUserBackgroundDTO fpShopUserBackground) throws SQLException {
		return fpShopUserBackgroundDao.queryListCount(fpShopUserBackground);
	}

	@Override
	public FpShopUserBackgroundDTO loadById(Integer id) throws SQLException {
		return fpShopUserBackgroundDao.loadById(id);
	}
 	@Override
	public FpShopUserBackgroundDTO queryListGetFirst(FpShopUserBackgroundDTO fpShopUserBackground)
			throws SQLException {
		 List<FpShopUserBackgroundDTO> queryList = queryList(fpShopUserBackground);
		 if(queryList==null||queryList.size()==0){
			 return new FpShopUserBackgroundDTO();
		 }
		 return queryList.get(0);
	}
}
